1. Field of the Invention
This invention generally relates to computing systems and in particular to systems for the implementation of efficient virtual function calls in hybrid compiled and interpreted programming language environments.
2. Description of the Related Art
Object oriented programming languages may support virtual function calls. This is the case for the object oriented language Java. Java is a trademark of Sun Microsystems, Inc. In such programming environments, functions (or methods) may be defined in a first class and then further defined in a subclass which inherits from first class. Calls to such functions or methods are referred to as virtual function calls. The extent to which functions are redefined in a piece of program code is termed the polymorphicity of the code. Programming environments which support virtual function calls include overhead to ensure that the correct function is accessed by a virtual function call.
In compiled environments, such as the typical C++ language environment, a successful approach to the implementation of virtual function calls is for the compiler to build a Virtual Function Table (VFT). The VFT includes information to permit the compiler to emit code that maps the source code virtual function call to a call to the correct function in the compiled code. VFTs provide efficient, uniform virtual call performance irrespective of the degree of polymorphicity and are reasonably compact in the memory space they occupy.
It is now common to improve the efficiency of Java language implementations by including Just In Time (JIT) compilation. In such Java JIT environments the Java virtual machine is able to call a JIT compiler to compile frequently used Java statements, typically at the function granularity. This permits increased efficiencies to be realized as the faster to execute compiled code may be used where appropriate.
In hybrid environments (such as the Java JIT interpreted and compiled environment), the use of VFTs has typically been seen as undesirable or inherently inefficient. In an interpreted-compiled environment, the prior art VFT solution does not efficiently handle the calling function due to the fact that a particular function signature may, in this hybrid environment, result in a call to a function that is either interpreted or compiled. The information required to efficiently carry out a function call is different for the two different types of functions that are being called. In addition, the calling function itself may be either interpreted or compiled in the hybrid interpreted-compiled environment. Further, called functions may be interpreted at the time that a calling function is compiled and then the called functions may later be compiled themselves.
Adaptations of VFTs to the hybrid interpreted-compiled environment have required VFTs to be uniformly accessed by and for both interpreted and compiled code with the consequential requirement that the interpreted or compiled code must include additional overhead in accessing the VFT to permit the access to be uniform. In the prior art, where VFTs are used in the hybrid environment, the interpreted environment is often modified to “look” like the compiled environment for the purposes of using the VFTs. This modification comes at the expense of reduced performance. Performing the transformation the other way also leads to performance issues as the compiled code is locked into a more restrictive calling convention.
Prior art approaches to implementing virtual function calls in interpreted-compiled environments include polymorphic inline caches at call sites, backed by global function caches fronting explicit function look ups. This approach is typically less efficient than the VFT solution, and also results in potentially non-uniform call performance.
It is therefore desirable to provide a hybrid interpreted-compiled programming language environment which provides for efficiently accessible virtual function tables.